package com.wanlian.router.bean;

import java.util.Locale;

/**
 * Created by Hyu on 2018/9/27.
 * Email: fvaryu@163.com
 */
public class YunFile extends Base{

    /**
     * id : 7
     * fileName : 体面
     * fileSize : 5.8
     * uploadTime : 1538021042000
     * fileType : 2
     * storageId : 1
     * userId : 22
     */

    private int id;
    private String fileName;
    private double fileSize;
    private long uploadTime;
    private int fileType;
    private int storageId;
    private int userId;
    private String filepath;
    private String filePath;


    private String format(double size) {
        int a = (int) size;
        if (a >= 1024) {
            return String.format(Locale.getDefault(),"%.2fG", size/1024);
        }
        return String.format(Locale.getDefault(),"%.2fM", size);
    }

    public String getUISize() {
        return format(fileSize);
    }


    public void setFilepath(String filepath) {
        this.filepath = filepath;
    }

    public String getFilePath() {
        return filepath == null ? filePath : filepath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public double getFileSize() {
        return fileSize;
    }

    public void setFileSize(double fileSize) {
        this.fileSize = fileSize;
    }

    public long getUploadTime() {
        return uploadTime;
    }

    public void setUploadTime(long uploadTime) {
        this.uploadTime = uploadTime;
    }

    public int getFileType() {
        return fileType;
    }

    public void setFileType(int fileType) {
        this.fileType = fileType;
    }

    public int getStorageId() {
        return storageId;
    }

    public void setStorageId(int storageId) {
        this.storageId = storageId;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }
}
